<script>on mouseUpif there is not a window "TheList"thenset cursor to watchListoid "TheList",cd fld "List"wait 1 secrepeat 50get loc of window "TheList"add 4 to item 1 of itadd 2 to item 2 of itset loc of window "TheList" to itset selectedLine of window "TheList" to random (20)end repeatwait 1 secset rect of window "TheList" to "50,50,250,200"wait 1 secset rect of window "TheList" to "200,110,312,248"put "NO,ONE,CON,DIS" into Listput "0 3 5,6,7 1,2,4,6" into Selrepeat with i=1 to 4put "Selection Mode =" && item i of Listset selectionMode of window "TheList" to item i of Listset selectedLine of window "TheList" to word i of Selwait 1 secend repeatput "Try by yourself now..."end ifend mouseUp</script>
</part>
<part>
<id>16</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <true /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <false /> </lockText>
<rect>
<left>417</left>
<top>256</top>
<right>512</right>
<bottom>342</bottom>
</rect>
<style>scrolling</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <false /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>9</textSize>
<textStyle>plain</textStyle>
<textHeight>12</textHeight>
<name>List</name>
<script></script>
</part>
<content>
<layer>card</layer>
<id>1</id>
<text> Listoid 1.4 by Frédéric RINALDI and the faithfull help of Benoît WIDEMANN for WDEF and CDEF resourcesDESCRIPTION------------ Listoid XCMD displays a list in a windoid.SYNTAX------- Listoid <WName>[,<List>[,<WStyle>][,<X,Y[,Z,T]>][,<NO|ONE|CON|DIS>] [,<selected line(s)>][<fontName[,size]>]]PARAMETERS------------ Only first param is needed. Order of params 3 to 7 doesn't matter, since the XCMD is able to recognize them. WName is a string giving the windoid name. Many windoids can be opened by using different names. List is a return or comma delimited string that will be displayed. Listoid provides an automatic separator recognition. WStyle is a string defining the window style. Allowed styles are : plain, zoom, roundRect, rect, shadow, windoid, windoidZoom, bigWindoid, bigWindoidZoom, Rinaldoid, RinaldoidZoom (Rinaldoid is the same as windoid, except that it displays the window title). All window styles are floating, except plain, zoom and roundRect. A windoid or Rinaldoid style window will have small scrollbars, while other styles will use standard size. Default is RinaldoidZoom if Rinaldoid WDEF resource is present, windoidZoom if not found. <X,Y[,Z,T]> will be a point or a rect, and will define position and/or size of the windoid. Coordinated are card-relative. If omitted, windoid will appear with standard size at "0,10". <NO|ONE|CON|DIS> defines the selection mode (no selection, one at a time, may but adjacent, many disjoint). Default is ONE. <selected line(s)> is an integer or a comma separated list of integers. It defines the selected line(s) when the windoid appears. Default is 1, but 0 can be used to have no selection at start. <fontName[,size]> is the name of font and its size to use. Default is Geneva 10. Using "!" and "?" as parameter will return an online help (resp. copyright and syntax).USING----- Listoid is stand alone, no linked resource is needed. Meanwhile, this stack contains a WDEF and a CDEF resource that are recognized by the XCMD if present. The WDEF allows to have an enhanced windoid-type window displaying title, while the CDEF is useful to get nice-looking scroll arrows for small scroll bars. So, these resources are optional, and for aesthetic purpose only. If you copy them, their ID can be set to any value but don't change their name.HINT : If you use a rect ot shadow style window, placing it on a card can simulate a smart HyperCard list field. If no rectangle param is used, the size of the window will be set accordingly to the longest string contained in the list. Clicking on item(s) in the windoid sends a "ListoidSelect" message followed by the clicked word(s) and the Listoid name.. This message can be trapped using a handler : on ListoidSelect What,Where if Where is "MyList" and What is ... end ListoidSelectNOTE : in order to avoid HyperCard's confusion, existing quotes in What param are automatically changed to single quote. When a windoid is opened, the "openListoid" message is sent, followed by the windoid name. This allows to define window properties before it is shown, since the message can be trapped using a handler : on openListoid Which if Which is "MyWindow" then... end openListoid When a windoid is close, the "closeListoid" message is sent, followed by the windoid name. This message can be trapped using a handler : on closeListoid Which if Which is "MyWindow" then... end closeListoidHINT : the card script contains a "on ControlKey" handler that allows selection of first item when typing a key in conjunction with control key. For best result, the list must be sorted. It is now possible to send any string to search for to the window using : “send "string" to window <WName>” If the string is found, it will be highlighted int the list. Look for "on controlKey" handler in the card script, type Control+Key to try it. Like any XWindow, Listoid has properties that can be get and set thru HyperTalk. “properties of window "name"” will return an item list of all allowed properties : • loc : windoid's position according to card • visible : windoid's visibility • text : windoid's text • rect : windoid's position and size according to card • selectedLine : line number(s) selected • selectionMode : selection mode (NO|ONE|CON|DIS)If an error occurs, external can return : "Error : Unrecognized parameter" "Error : Missing window name" "Error : Duplicate window name" "Error : Empty parameter" "Error : Unable to create XWindow" "Error : XWindows not implemented"HISTORY--------1.4 :• Added window style parameter• Added "openListoid" message• Added searching capabilities• Added quote filter for ListoidSelect message parameters• Fixed rect/globalRect property to not show window if invisible• Added support of Rinaldoid WDEF and CDEF1.3 :• Added font name and size parameter1.1 :• Window title is now displayed• Added window name parameter• Window name is passed along with ListoidSelect message.• Added closeListoid message--------------------------------------------------------------------This (these) external(s) is (are) FreeWare,allowing unlimited use in any non-commercial stack. You just need in this case to mention the author's name and copyright in your stack.Any commercial use must be licensed and aknowledged by the author. © F. Rinaldi - 1989,1990AppleLink: RINALDI1 CalvaCom : FR10 Compuserve : 71170,2111</text>